<template>
	<div id="searchList">
		<van-list v-model="loading" :finished="finished" finished-text="没有更多了" @load="onLoad">
		  <div v-for="item in $store.state.searchList">
			  <van-cell :key="item.alias_id">
			  		<van-card :thumb="item.cover">
						<!-- 标题 -->
			  			 <template #title>
			  			    <h3>{{item.title}}<small v-if="item.kind">{{item.kind}}</small></h3>
			  			  </template>
			  			
						<!-- 详情 -->  
			  			  <template #desc>
			  				<p class="author" v-if="item.author">{{item.author}}</p>
			  				<div>
								<p v-if="item.has_finished" class="bookkind">已完结，共{{item.on_sale_num}}篇</p>
								<p v-else class="bookkind">已发表{{item.on_sale_num}}篇</p>
							</div>
			  				<p class="detail" v-if="item.abstract">{{item.abstract}}</p>
			  			  </template>
			  			  
			  			  <template #price>
							<p v-if="item.in_library_count">{{item.in_library_count}} 加入书架</p>
			  				<!-- <p v-if="!item.price">{{item.in_library_count}} 加入书架</p>
			  				<p v-else class="price"><small>￥</small>{{item.price}}</p> -->
			  			  </template>
			  
			  		</van-card>
			  </van-cell>
		  </div>
		</van-list>
	</div>
</template>

<script>
	import Vue from 'vue';
	
	export default {
	  data() {
	    return {
	      list: [],
	      loading: false,
	      finished: false,
	    };
	  },
	  methods: {
			onLoad() {
				this.$store.dispatch('getSearch')
				
				//         // 加载状态结束
				//         this.loading = false;
				
				//         // 数据全部加载完成
				//         if (this.list.length >= 40) {
				//           this.finished = true;
				//         }
			},
			detail(){
				this.$router.push('/detail')  
				
			}
	  },
	}
</script>

<style lang="scss">
</style>